//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS CodeGuruReviewer service.
///
/// This section provides documentation for the Amazon CodeGuru Reviewer API operations. CodeGuru Reviewer is a service that uses program analysis and machine learning to detect potential defects that are difficult for developers to find and recommends fixes in your Java and Python code. By proactively detecting and providing recommendations for addressing code defects and implementing best practices, CodeGuru Reviewer improves the overall quality and maintainability of your code base during the code review stage. For more information about CodeGuru Reviewer, see the  Amazon CodeGuru Reviewer User Guide.  To improve the security of your CodeGuru Reviewer API calls, you can establish a private connection between your VPC and CodeGuru Reviewer by creating an interface VPC endpoint. For more information, see CodeGuru Reviewer and interface VPC endpoints (Amazon Web Services PrivateLink) in the Amazon CodeGuru Reviewer User Guide.
public struct CodeGuruReviewer: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the CodeGuruReviewer client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "CodeGuruReviewer",
            serviceIdentifier: "codeguru-reviewer",
            serviceProtocol: .restjson,
            apiVersion: "2019-09-19",
            endpoint: endpoint,
            errorType: CodeGuruReviewerErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Use to associate an Amazon Web Services CodeCommit repository or a repository managed by Amazon Web Services CodeStar Connections with Amazon CodeGuru Reviewer. When you associate a repository, CodeGuru Reviewer reviews source code changes in the repository's pull requests and provides automatic recommendations. You can view recommendations using the CodeGuru Reviewer console. For more information, see Recommendations in Amazon CodeGuru Reviewer in the Amazon CodeGuru Reviewer User Guide.  If you associate a CodeCommit or S3 repository, it must be in the same Amazon Web Services Region and Amazon Web Services account where its CodeGuru Reviewer code reviews are configured. Bitbucket and GitHub Enterprise Server repositories are managed by Amazon Web Services CodeStar Connections to connect to CodeGuru Reviewer. For more information, see Associate a repository in the Amazon CodeGuru Reviewer User Guide.   You cannot use the CodeGuru Reviewer SDK or the Amazon Web Services CLI to associate a GitHub repository with Amazon CodeGuru Reviewer. To associate a GitHub repository, use the console. For more information, see Getting started with CodeGuru Reviewer in the CodeGuru Reviewer User Guide.
    @Sendable
    @inlinable
    public func associateRepository(_ input: AssociateRepositoryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> AssociateRepositoryResponse {
        try await self.client.execute(
            operation: "AssociateRepository", 
            path: "/associations", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Use to associate an Amazon Web Services CodeCommit repository or a repository managed by Amazon Web Services CodeStar Connections with Amazon CodeGuru Reviewer. When you associate a repository, CodeGuru Reviewer reviews source code changes in the repository's pull requests and provides automatic recommendations. You can view recommendations using the CodeGuru Reviewer console. For more information, see Recommendations in Amazon CodeGuru Reviewer in the Amazon CodeGuru Reviewer User Guide.  If you associate a CodeCommit or S3 repository, it must be in the same Amazon Web Services Region and Amazon Web Services account where its CodeGuru Reviewer code reviews are configured. Bitbucket and GitHub Enterprise Server repositories are managed by Amazon Web Services CodeStar Connections to connect to CodeGuru Reviewer. For more information, see Associate a repository in the Amazon CodeGuru Reviewer User Guide.   You cannot use the CodeGuru Reviewer SDK or the Amazon Web Services CLI to associate a GitHub repository with Amazon CodeGuru Reviewer. To associate a GitHub repository, use the console. For more information, see Getting started with CodeGuru Reviewer in the CodeGuru Reviewer User Guide.
    ///
    /// Parameters:
    ///   - clientRequestToken: Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate repository associations if there are failures and retries.
    ///   - kmsKeyDetails: A KMSKeyDetails object that contains:   The encryption option for this repository association. It is either owned by Amazon Web Services Key Management Service (KMS) (AWS_OWNED_CMK) or customer managed (CUSTOMER_MANAGED_CMK).   The ID of the Amazon Web Services KMS key that is associated with this repository association.
    ///   - repository: The repository to associate.
    ///   - tags: An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
    ///   - logger: Logger use during operation
    @inlinable
    public func associateRepository(
        clientRequestToken: String? = AssociateRepositoryRequest.idempotencyToken(),
        kmsKeyDetails: KMSKeyDetails? = nil,
        repository: Repository,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> AssociateRepositoryResponse {
        let input = AssociateRepositoryRequest(
            clientRequestToken: clientRequestToken, 
            kmsKeyDetails: kmsKeyDetails, 
            repository: repository, 
            tags: tags
        )
        return try await self.associateRepository(input, logger: logger)
    }

    /// Use to create a code review with a CodeReviewType of RepositoryAnalysis. This type of code review analyzes all code under a specified branch in an associated repository. PullRequest code reviews are automatically triggered by a pull request.
    @Sendable
    @inlinable
    public func createCodeReview(_ input: CreateCodeReviewRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateCodeReviewResponse {
        try await self.client.execute(
            operation: "CreateCodeReview", 
            path: "/codereviews", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Use to create a code review with a CodeReviewType of RepositoryAnalysis. This type of code review analyzes all code under a specified branch in an associated repository. PullRequest code reviews are automatically triggered by a pull request.
    ///
    /// Parameters:
    ///   - clientRequestToken: Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.
    ///   - name: The name of the code review. The name of each code review in your Amazon Web Services account must be unique.
    ///   - repositoryAssociationArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations. A code review can only be created on an associated repository. This is the ARN of the associated repository.
    ///   - type: The type of code review to create. This is specified using a CodeReviewType object. You can create a code review only of type RepositoryAnalysis.
    ///   - logger: Logger use during operation
    @inlinable
    public func createCodeReview(
        clientRequestToken: String? = CreateCodeReviewRequest.idempotencyToken(),
        name: String,
        repositoryAssociationArn: String,
        type: CodeReviewType,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateCodeReviewResponse {
        let input = CreateCodeReviewRequest(
            clientRequestToken: clientRequestToken, 
            name: name, 
            repositoryAssociationArn: repositoryAssociationArn, 
            type: type
        )
        return try await self.createCodeReview(input, logger: logger)
    }

    /// Returns the metadata associated with the code review along with its status.
    @Sendable
    @inlinable
    public func describeCodeReview(_ input: DescribeCodeReviewRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeCodeReviewResponse {
        try await self.client.execute(
            operation: "DescribeCodeReview", 
            path: "/codereviews/{CodeReviewArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the metadata associated with the code review along with its status.
    ///
    /// Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeCodeReview(
        codeReviewArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeCodeReviewResponse {
        let input = DescribeCodeReviewRequest(
            codeReviewArn: codeReviewArn
        )
        return try await self.describeCodeReview(input, logger: logger)
    }

    /// Describes the customer feedback for a CodeGuru Reviewer recommendation.
    @Sendable
    @inlinable
    public func describeRecommendationFeedback(_ input: DescribeRecommendationFeedbackRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeRecommendationFeedbackResponse {
        try await self.client.execute(
            operation: "DescribeRecommendationFeedback", 
            path: "/feedback/{CodeReviewArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Describes the customer feedback for a CodeGuru Reviewer recommendation.
    ///
    /// Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - recommendationId: The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.
    ///   - userId: Optional parameter to describe the feedback for a given user. If this is not supplied, it defaults to the user making the request.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeRecommendationFeedback(
        codeReviewArn: String,
        recommendationId: String,
        userId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeRecommendationFeedbackResponse {
        let input = DescribeRecommendationFeedbackRequest(
            codeReviewArn: codeReviewArn, 
            recommendationId: recommendationId, 
            userId: userId
        )
        return try await self.describeRecommendationFeedback(input, logger: logger)
    }

    /// Returns a RepositoryAssociation object that contains information about the requested repository association.
    @Sendable
    @inlinable
    public func describeRepositoryAssociation(_ input: DescribeRepositoryAssociationRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeRepositoryAssociationResponse {
        try await self.client.execute(
            operation: "DescribeRepositoryAssociation", 
            path: "/associations/{AssociationArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a RepositoryAssociation object that contains information about the requested repository association.
    ///
    /// Parameters:
    ///   - associationArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeRepositoryAssociation(
        associationArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeRepositoryAssociationResponse {
        let input = DescribeRepositoryAssociationRequest(
            associationArn: associationArn
        )
        return try await self.describeRepositoryAssociation(input, logger: logger)
    }

    /// Removes the association between Amazon CodeGuru Reviewer and a repository.
    @Sendable
    @inlinable
    public func disassociateRepository(_ input: DisassociateRepositoryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DisassociateRepositoryResponse {
        try await self.client.execute(
            operation: "DisassociateRepository", 
            path: "/associations/{AssociationArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes the association between Amazon CodeGuru Reviewer and a repository.
    ///
    /// Parameters:
    ///   - associationArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - logger: Logger use during operation
    @inlinable
    public func disassociateRepository(
        associationArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DisassociateRepositoryResponse {
        let input = DisassociateRepositoryRequest(
            associationArn: associationArn
        )
        return try await self.disassociateRepository(input, logger: logger)
    }

    /// Lists all the code reviews that the customer has created in the past 90 days.
    @Sendable
    @inlinable
    public func listCodeReviews(_ input: ListCodeReviewsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListCodeReviewsResponse {
        try await self.client.execute(
            operation: "ListCodeReviews", 
            path: "/codereviews", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all the code reviews that the customer has created in the past 90 days.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - nextToken: If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.
    ///   - providerTypes: List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=[GitHub] lists code reviews from GitHub.
    ///   - repositoryNames: List of repository names for filtering that needs to be applied before displaying the result.
    ///   - states: List of states for filtering that needs to be applied before displaying the result. For example, states=[Pending] lists code reviews in the Pending state. The valid code review states are:    Completed: The code review is complete.    Pending: The code review started and has not completed or failed.    Failed: The code review failed.    Deleting: The code review is being deleted.
    ///   - type: The type of code reviews to list in the response.
    ///   - logger: Logger use during operation
    @inlinable
    public func listCodeReviews(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        providerTypes: [ProviderType]? = nil,
        repositoryNames: [String]? = nil,
        states: [JobState]? = nil,
        type: `Type`,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListCodeReviewsResponse {
        let input = ListCodeReviewsRequest(
            maxResults: maxResults, 
            nextToken: nextToken, 
            providerTypes: providerTypes, 
            repositoryNames: repositoryNames, 
            states: states, 
            type: type
        )
        return try await self.listCodeReviews(input, logger: logger)
    }

    /// Returns a list of RecommendationFeedbackSummary objects that contain customer recommendation feedback for all CodeGuru Reviewer users.
    @Sendable
    @inlinable
    public func listRecommendationFeedback(_ input: ListRecommendationFeedbackRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListRecommendationFeedbackResponse {
        try await self.client.execute(
            operation: "ListRecommendationFeedback", 
            path: "/feedback/{CodeReviewArn}/RecommendationFeedback", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of RecommendationFeedbackSummary objects that contain customer recommendation feedback for all CodeGuru Reviewer users.
    ///
    /// Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - nextToken: If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.
    ///   - recommendationIds: Used to query the recommendation feedback for a given recommendation.
    ///   - userIds: An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the recommendation feedback for a code review from that user.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
    ///   - logger: Logger use during operation
    @inlinable
    public func listRecommendationFeedback(
        codeReviewArn: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        recommendationIds: [String]? = nil,
        userIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListRecommendationFeedbackResponse {
        let input = ListRecommendationFeedbackRequest(
            codeReviewArn: codeReviewArn, 
            maxResults: maxResults, 
            nextToken: nextToken, 
            recommendationIds: recommendationIds, 
            userIds: userIds
        )
        return try await self.listRecommendationFeedback(input, logger: logger)
    }

    /// Returns the list of all recommendations for a completed code review.
    @Sendable
    @inlinable
    public func listRecommendations(_ input: ListRecommendationsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListRecommendationsResponse {
        try await self.client.execute(
            operation: "ListRecommendations", 
            path: "/codereviews/{CodeReviewArn}/Recommendations", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the list of all recommendations for a completed code review.
    ///
    /// Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - nextToken: Pagination token.
    ///   - logger: Logger use during operation
    @inlinable
    public func listRecommendations(
        codeReviewArn: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListRecommendationsResponse {
        let input = ListRecommendationsRequest(
            codeReviewArn: codeReviewArn, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listRecommendations(input, logger: logger)
    }

    /// Returns a list of RepositoryAssociationSummary objects that contain summary information about a repository association. You can filter the returned list by ProviderType, Name, State, and Owner.
    @Sendable
    @inlinable
    public func listRepositoryAssociations(_ input: ListRepositoryAssociationsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListRepositoryAssociationsResponse {
        try await self.client.execute(
            operation: "ListRepositoryAssociations", 
            path: "/associations", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of RepositoryAssociationSummary objects that contain summary information about a repository association. You can filter the returned list by ProviderType, Name, State, and Owner.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of repository association results returned by ListRepositoryAssociations in paginated output. When this parameter is used, ListRepositoryAssociations only returns maxResults results in a single page with a nextToken response element. The remaining results of the initial request can be seen by sending another ListRepositoryAssociations request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, ListRepositoryAssociations returns up to 100 results and a nextToken value if applicable.
    ///   - names: List of repository names to use as a filter.
    ///   - nextToken: The nextToken value returned from a previous paginated ListRepositoryAssociations request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.   Treat this token as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
    ///   - owners: List of owners to use as a filter. For Amazon Web Services CodeCommit, it is the name of the CodeCommit account that was used to associate the repository. For other repository source providers, such as Bitbucket and GitHub Enterprise Server, this is name of the account that was used to associate the repository.
    ///   - providerTypes: List of provider types to use as a filter.
    ///   - states: List of repository association states to use as a filter. The valid repository association states are:    Associated: The repository association is complete.    Associating: CodeGuru Reviewer is:   Setting up pull request notifications. This is required  for pull requests to trigger a CodeGuru Reviewer review.  If your repository ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.    Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.      Failed: The repository failed to associate or disassociate.    Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code access.    Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in anassociated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
    ///   - logger: Logger use during operation
    @inlinable
    public func listRepositoryAssociations(
        maxResults: Int? = nil,
        names: [String]? = nil,
        nextToken: String? = nil,
        owners: [String]? = nil,
        providerTypes: [ProviderType]? = nil,
        states: [RepositoryAssociationState]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListRepositoryAssociationsResponse {
        let input = ListRepositoryAssociationsRequest(
            maxResults: maxResults, 
            names: names, 
            nextToken: nextToken, 
            owners: owners, 
            providerTypes: providerTypes, 
            states: states
        )
        return try await self.listRepositoryAssociations(input, logger: logger)
    }

    /// Returns the list of tags associated with an associated repository resource.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the list of tags associated with an associated repository resource.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Stores customer feedback for a CodeGuru Reviewer recommendation. When this API is called again with different reactions the previous feedback is overwritten.
    @Sendable
    @inlinable
    public func putRecommendationFeedback(_ input: PutRecommendationFeedbackRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> PutRecommendationFeedbackResponse {
        try await self.client.execute(
            operation: "PutRecommendationFeedback", 
            path: "/feedback", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stores customer feedback for a CodeGuru Reviewer recommendation. When this API is called again with different reactions the previous feedback is overwritten.
    ///
    /// Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - reactions: List for storing reactions. Reactions are utf-8 text code for emojis. If you send an empty list it clears all your feedback.
    ///   - recommendationId: The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.
    ///   - logger: Logger use during operation
    @inlinable
    public func putRecommendationFeedback(
        codeReviewArn: String,
        reactions: [Reaction],
        recommendationId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> PutRecommendationFeedbackResponse {
        let input = PutRecommendationFeedbackRequest(
            codeReviewArn: codeReviewArn, 
            reactions: reactions, 
            recommendationId: recommendationId
        )
        return try await self.putRecommendationFeedback(input, logger: logger)
    }

    /// Adds one or more tags to an associated repository.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Adds one or more tags to an associated repository.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - tags: An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes a tag from an associated repository.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes a tag from an associated repository.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - tagKeys: A list of the keys for each tag you want to remove from an associated repository.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }
}

extension CodeGuruReviewer {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: CodeGuruReviewer, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CodeGuruReviewer {
    /// Return PaginatorSequence for operation ``listCodeReviews(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listCodeReviewsPaginator(
        _ input: ListCodeReviewsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListCodeReviewsRequest, ListCodeReviewsResponse> {
        return .init(
            input: input,
            command: self.listCodeReviews,
            inputKey: \ListCodeReviewsRequest.nextToken,
            outputKey: \ListCodeReviewsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listCodeReviews(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - providerTypes: List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=[GitHub] lists code reviews from GitHub.
    ///   - repositoryNames: List of repository names for filtering that needs to be applied before displaying the result.
    ///   - states: List of states for filtering that needs to be applied before displaying the result. For example, states=[Pending] lists code reviews in the Pending state. The valid code review states are:    Completed: The code review is complete.    Pending: The code review started and has not completed or failed.    Failed: The code review failed.    Deleting: The code review is being deleted.
    ///   - type: The type of code reviews to list in the response.
    ///   - logger: Logger used for logging
    @inlinable
    public func listCodeReviewsPaginator(
        maxResults: Int? = nil,
        providerTypes: [ProviderType]? = nil,
        repositoryNames: [String]? = nil,
        states: [JobState]? = nil,
        type: `Type`,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListCodeReviewsRequest, ListCodeReviewsResponse> {
        let input = ListCodeReviewsRequest(
            maxResults: maxResults, 
            providerTypes: providerTypes, 
            repositoryNames: repositoryNames, 
            states: states, 
            type: type
        )
        return self.listCodeReviewsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listRecommendationFeedback(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listRecommendationFeedbackPaginator(
        _ input: ListRecommendationFeedbackRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListRecommendationFeedbackRequest, ListRecommendationFeedbackResponse> {
        return .init(
            input: input,
            command: self.listRecommendationFeedback,
            inputKey: \ListRecommendationFeedbackRequest.nextToken,
            outputKey: \ListRecommendationFeedbackResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listRecommendationFeedback(_:logger:)``.
    ///
    /// - Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - recommendationIds: Used to query the recommendation feedback for a given recommendation.
    ///   - userIds: An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the recommendation feedback for a code review from that user.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
    ///   - logger: Logger used for logging
    @inlinable
    public func listRecommendationFeedbackPaginator(
        codeReviewArn: String,
        maxResults: Int? = nil,
        recommendationIds: [String]? = nil,
        userIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListRecommendationFeedbackRequest, ListRecommendationFeedbackResponse> {
        let input = ListRecommendationFeedbackRequest(
            codeReviewArn: codeReviewArn, 
            maxResults: maxResults, 
            recommendationIds: recommendationIds, 
            userIds: userIds
        )
        return self.listRecommendationFeedbackPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listRecommendations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listRecommendationsPaginator(
        _ input: ListRecommendationsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListRecommendationsRequest, ListRecommendationsResponse> {
        return .init(
            input: input,
            command: self.listRecommendations,
            inputKey: \ListRecommendationsRequest.nextToken,
            outputKey: \ListRecommendationsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listRecommendations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - maxResults: The maximum number of results that are returned per call. The default is 100.
    ///   - logger: Logger used for logging
    @inlinable
    public func listRecommendationsPaginator(
        codeReviewArn: String,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListRecommendationsRequest, ListRecommendationsResponse> {
        let input = ListRecommendationsRequest(
            codeReviewArn: codeReviewArn, 
            maxResults: maxResults
        )
        return self.listRecommendationsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listRepositoryAssociations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listRepositoryAssociationsPaginator(
        _ input: ListRepositoryAssociationsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListRepositoryAssociationsRequest, ListRepositoryAssociationsResponse> {
        return .init(
            input: input,
            command: self.listRepositoryAssociations,
            inputKey: \ListRepositoryAssociationsRequest.nextToken,
            outputKey: \ListRepositoryAssociationsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listRepositoryAssociations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of repository association results returned by ListRepositoryAssociations in paginated output. When this parameter is used, ListRepositoryAssociations only returns maxResults results in a single page with a nextToken response element. The remaining results of the initial request can be seen by sending another ListRepositoryAssociations request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, ListRepositoryAssociations returns up to 100 results and a nextToken value if applicable.
    ///   - names: List of repository names to use as a filter.
    ///   - owners: List of owners to use as a filter. For Amazon Web Services CodeCommit, it is the name of the CodeCommit account that was used to associate the repository. For other repository source providers, such as Bitbucket and GitHub Enterprise Server, this is name of the account that was used to associate the repository.
    ///   - providerTypes: List of provider types to use as a filter.
    ///   - states: List of repository association states to use as a filter. The valid repository association states are:    Associated: The repository association is complete.    Associating: CodeGuru Reviewer is:   Setting up pull request notifications. This is required  for pull requests to trigger a CodeGuru Reviewer review.  If your repository ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.    Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.      Failed: The repository failed to associate or disassociate.    Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code access.    Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in anassociated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
    ///   - logger: Logger used for logging
    @inlinable
    public func listRepositoryAssociationsPaginator(
        maxResults: Int? = nil,
        names: [String]? = nil,
        owners: [String]? = nil,
        providerTypes: [ProviderType]? = nil,
        states: [RepositoryAssociationState]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListRepositoryAssociationsRequest, ListRepositoryAssociationsResponse> {
        let input = ListRepositoryAssociationsRequest(
            maxResults: maxResults, 
            names: names, 
            owners: owners, 
            providerTypes: providerTypes, 
            states: states
        )
        return self.listRepositoryAssociationsPaginator(input, logger: logger)
    }
}

extension CodeGuruReviewer.ListCodeReviewsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CodeGuruReviewer.ListCodeReviewsRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            providerTypes: self.providerTypes,
            repositoryNames: self.repositoryNames,
            states: self.states,
            type: self.type
        )
    }
}

extension CodeGuruReviewer.ListRecommendationFeedbackRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CodeGuruReviewer.ListRecommendationFeedbackRequest {
        return .init(
            codeReviewArn: self.codeReviewArn,
            maxResults: self.maxResults,
            nextToken: token,
            recommendationIds: self.recommendationIds,
            userIds: self.userIds
        )
    }
}

extension CodeGuruReviewer.ListRecommendationsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CodeGuruReviewer.ListRecommendationsRequest {
        return .init(
            codeReviewArn: self.codeReviewArn,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension CodeGuruReviewer.ListRepositoryAssociationsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CodeGuruReviewer.ListRepositoryAssociationsRequest {
        return .init(
            maxResults: self.maxResults,
            names: self.names,
            nextToken: token,
            owners: self.owners,
            providerTypes: self.providerTypes,
            states: self.states
        )
    }
}

// MARK: Waiters

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CodeGuruReviewer {
    /// Waiter for operation ``describeCodeReview(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilCodeReviewCompleted(
        _ input: DescribeCodeReviewRequest,
        maxWaitTime: TimeAmount? = nil,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws {
        let waiter = AWSClient.Waiter<DescribeCodeReviewRequest, _>(
            acceptors: [
                .init(state: .success, matcher: try! JMESPathMatcher("codeReview.state", expected: "Completed")),
                .init(state: .failure, matcher: try! JMESPathMatcher("codeReview.state", expected: "Failed")),
                .init(state: .retry, matcher: try! JMESPathMatcher("codeReview.state", expected: "Pending")),
            ],
            minDelayTime: .seconds(10),
            command: self.describeCodeReview
        )
        return try await self.client.waitUntil(input, waiter: waiter, maxWaitTime: maxWaitTime, logger: logger)
    }
    /// Waiter for operation ``describeCodeReview(_:logger:)``.
    ///
    /// - Parameters:
    ///   - codeReviewArn: The Amazon Resource Name (ARN) of the CodeReview object.
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilCodeReviewCompleted(
        codeReviewArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DescribeCodeReviewRequest(
            codeReviewArn: codeReviewArn
        )
        try await self.waitUntilCodeReviewCompleted(input, logger: logger)
    }

    /// Waiter for operation ``describeRepositoryAssociation(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilRepositoryAssociationSucceeded(
        _ input: DescribeRepositoryAssociationRequest,
        maxWaitTime: TimeAmount? = nil,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws {
        let waiter = AWSClient.Waiter<DescribeRepositoryAssociationRequest, _>(
            acceptors: [
                .init(state: .success, matcher: try! JMESPathMatcher("repositoryAssociation.state", expected: "Associated")),
                .init(state: .failure, matcher: try! JMESPathMatcher("repositoryAssociation.state", expected: "Failed")),
                .init(state: .retry, matcher: try! JMESPathMatcher("repositoryAssociation.state", expected: "Associating")),
            ],
            minDelayTime: .seconds(10),
            command: self.describeRepositoryAssociation
        )
        return try await self.client.waitUntil(input, waiter: waiter, maxWaitTime: maxWaitTime, logger: logger)
    }
    /// Waiter for operation ``describeRepositoryAssociation(_:logger:)``.
    ///
    /// - Parameters:
    ///   - associationArn: The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilRepositoryAssociationSucceeded(
        associationArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DescribeRepositoryAssociationRequest(
            associationArn: associationArn
        )
        try await self.waitUntilRepositoryAssociationSucceeded(input, logger: logger)
    }
}
